import java.util.Scanner;

public class MC0319小码哥幸运日 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int L = scanner.nextInt();
        int R = scanner.nextInt();
        int count = 0;
        for (int i = L; i <= R; i++) {
            count += countOccurrencesOfTwoMath(i);
        }
        System.out.println(count);
        scanner.close();
    }

    //判断数字个十百上面的数字
    public static int countOccurrencesOfTwoMath(int n) {
        if (n == 0) {
            return 0;
        }
        int count = 0;
        while (n > 0) {
            if (n % 10 == 2) {
                count++;
            }
            n /= 10;
        }
        return count;
    }
}
